package com.kris.model.system;

import com.kris.config.systemConstants;

import java.io.Serializable;


public class ResultModel implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 返回结果状态码 */
    private int code;

    /** 返回结果 */
    private Object result = null;

    public ResultModel() {
        this.code = systemConstants.ResponseCode.SUCCESS.value();
    }

    public ResultModel(int code) {
        this.code = code;
    }

    public ResultModel(int code, Object result) {
        this.code = code;
        this.result = result;
    }

    public int getcode() {
        return code;
    }

    public void setcode(int code) {
        this.code = code;
    }

    public Object getresult() {
        return result;
    }

    public void setresult(Object result) {
        this.result = result;
    }

    public void error() {
        this.code = systemConstants.ResponseCode.ERROR.value();
    }

    public void error(Object result) {
        this.code = systemConstants.ResponseCode.ERROR.value();
        this.result = result;
    }

    public void success() {
        this.code = systemConstants.ResponseCode.SUCCESS.value();
    }

    public void success(Object result) {
        this.code = systemConstants.ResponseCode.SUCCESS.value();
        this.result = result;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer(512);
        sb.append(super.toString());
        sb.append("\n    code=").append(this.code);
        sb.append("\n    result=").append(this.result);
        return super.toString();
    }

    /** 流程执行-未设置成员 */
    public static final int WORKFLOW_NO_MEMBER = 2000;

    /** 退出团队失败(至少有一个管理员) */
    public static final int QUIT_CORP  = 3000;

}